//单位时间内只执行最后一次
function throttle(fn, t) {
  let timer;
  return function (...arg) {
    if (!timer) {
      timer = setTimeout(() => {
        fn.apply(this, arg);
        timer = null;
      }, t);
    }
  };
}
